/*
 * @Author: long-xinyu2 2192763423@qq.com
 * @Date: 2025-05-20 10:52:08
 * @LastEditors: long-xinyu2 2192763423@qq.com
 * @LastEditTime: 2025-05-20 18:39:15
 * @FilePath: \algorithm-training\xx.cpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 998244853;
typedef long long LL;
const int N = 210;

int qmi(int a,LL b,int p)
{
    int res = 1;
    while(b)
    {
        if(b & 1) res = 1LL * res * a % p;
        a = 1LL * a * a % p;
        b>>=1;
    }
    return res;
}


int state[N];
int st[N];
int flag[N][N];
int match[N];
int n,m;
int dfs(int x)
{
    for(int i = 1; i <= m; i ++)
    {
        if(!st[i] && flag[x][i] == false)
        {
            st[i] = true;
            if(!match[i] || dfs(match[i]))
            {
                match[i] = x;
                return true;
            }
        }
    }
    return false;
}

void solve(){
    cin >> n >> m;
    int q;
    cin >> q;
    for(int i = 1; i <= q; i ++)
    {
        int a,b;
        cin >> a >> b;
        flag[a][b] = 1;
    }
    int ans = 0;
    for(int i = 1; i <= n; i ++)
    {
        memset(st,0,sizeof st);

        if(dfs(i)) ans ++;
    }
    cout << ans << endl;
}
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
}
